package com.d0325;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TestSimpleDateFormat {
    public static void main(String[] args) {
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy年MM月dd日");
        SimpleDateFormat simpleDateFormat1=new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
        Date date= new Date();
        System.out.println(simpleDateFormat.format(date));
        System.out.println(simpleDateFormat1.format(date));
        Calendar calendar=Calendar.getInstance();
        calendar.set(2020,Calendar.MARCH,31,10,23,45);
        System.out.println(simpleDateFormat.format(calendar.getTime()));
        System.out.println(simpleDateFormat1.format(calendar.getTime()));

        String birth="1997/06/02 13:24:44";
        try {
            Date birDate=simpleDateFormat1.parse(birth);
            System.out.println(birDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
